package com.gy.smart.handle.adapter;

import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;

import com.gy.smart.R;
import com.gy.smart.handle.bean.HandleListBean;

import java.util.List;

/**
 * 作者：gy on 17/1/4
 * 说明：办事指南列表
 */
public class HandleListAdapter extends BaseAdapter {

    public Context context;
    private List<HandleListBean> list;

    public HandleListAdapter(Context context,List<HandleListBean> list){
        this.context = context;
        this.list = list;
    }

    @Override
    public int getCount() {
        return list.size();
    }

    @Override
    public Object getItem(int position) {
        return null;
    }

    @Override
    public long getItemId(int position) {
        return 0;
    }

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
        ViewHolder holder;
        if(convertView == null){
            holder = new ViewHolder();
            convertView = View.inflate(context, R.layout.adapter_handle_list,null);
            holder.tvTitle = (TextView) convertView.findViewById(R.id.adapter_handle_list_tv_title);
            holder.tvFrom = (TextView) convertView.findViewById(R.id.adapter_handle_list_tv_from);
            convertView.setTag(holder);
        } else {
            holder = (ViewHolder) convertView.getTag();
        }

        holder.tvTitle.setText(list.get(position).title+"");
        holder.tvFrom.setText("办理机构:"+list.get(position).section_name);

        return convertView;
    }

    class ViewHolder{
        TextView tvTitle,tvFrom;
    }
}


